<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/9/20 0020
  Time: 上午 10:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>活动列表</title>
    <script src="/js/jquery-3.3.1.min.js" charset="utf-8"></script>
    <script src="/js/cookie/jquery.cookie.js" charset="utf-8"></script>
    <script src="/layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <script src="/js/layui/form_verify.js"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">
</head>
<body>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;margin-right: 100px"  href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>活动列表</legend>
    <c:if test="${fn:length(activityList)==0}">
        <button class="layui-btn" onclick="activityInfo('','${orgId}')">添加活动</button>
    </c:if>
</fieldset>

<div class="layui-form">
    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col width="150">
            <col width="150">
<%--            <col width="200">
            <col width="150">--%>
            <col width="150">
            <col width="200">
            <col width="200">
            <col width="200">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>名称</th>
            <th>转发标题</th>
            <th>购买价格</th>
            <th>开始时间</th>
            <th>结束时间</th>
           <%-- <th>一级返利金额</th>
            <th>二级返利金额</th>--%>
            <th>创建时间</th>
            <th>服务费</th>
            <th>拼团规则</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>

            <c:forEach items="${activityList}" var="activity">
                <tr>
                    <th>${activity.name}</th>
                    <th>${activity.transmitTitle}</th>
                    <th>${activity.price/100}</th>
                    <th>${activity.startTime}</th>
                    <th>${activity.endTime}</th>
                   <%-- <th>${activity.oneRebate/100}</th>
                    <th>${activity.twoRebate/100}</th>--%>
                    <th>${activity.createTime}</th>
                    <th>${activity.serviceMoney/100}</th>
                    <th>
                        <button class="layui-btn" onclick="goRefundRuleList('${activity.id}','${activity.orgId}')">人数增加，退款规则</button>
                        <br>
                        <br>
                        <button class="layui-btn" onclick="goTransmitRule('${activity.id}','${activity.orgId}')">推广红包发放规则</button>
                    </th>
                    <th><button class="layui-btn" onclick="activityInfo('${activity.id}','${activity.orgId}')">活动详情</button></th>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</div>
<script>

    layui.use('layer', function(){

    });

    function activityInfo(activityId,orgId) {
        layer.open({
            type: 2,
            title:"活动信息",
            shadeClose:true,
            offset: '0px',
            area: ['90%', '90%'],
            content: '/group/goGroupActivityInfo?activityId='+activityId+"&orgId="+orgId,
            end:function () {
                window.location.reload();
            }
        });
    }
</script>

<script>
    function goRefundRuleList(activityId,orgId) {
        layer.open({
            type: 2,
            title:"退款规则",
            shadeClose:true,
            area: ['95%', '95%'],
            offset: '0px',
            content: '/group/groupRefundSetting?orgId='+orgId+'&activityId='+activityId,
            end:function () {
                window.location.reload();
            }
        });
    }

    function goTransmitRule(activityId,orgId) {
        layer.open({
            type: 2,
            title:"转发到朋友圈红包规则",
            shadeClose:true,
            area: ['95%', '95%'],
            offset: '0px',
            content: '/group/transmitRule?orgId='+orgId+'&activityId='+activityId,
            end:function () {
                window.location.reload();
            }
        });
    }

</script>
</body>
</html>
